﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UCLookUpToChucHanhChinh.ascx.cs"
    Inherits="Viewer.ToChuc.UserControl.UCLookUpToChucHanhChinh" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script type="text/javascript">
    var refreshTree = function(tree, result) {
        var nodes = eval(result);
        if (nodes.length > 0) {
            tree.initChildren(nodes);
        }
        else {
            tree.getRootNode().removeChildren();
        }
    }
</script>
<ext:Window ID="wdLookUpToChucHanhChinh" runat="server" Width="350"  Height="400" Modal="true" Hidden="true" 
     BodyCssClass="window" Title="Chọn Tổ Chức Hành Chính" Icon="Find">
    <Items>
        <ext:TreePanel ID="treeToChucHanhChinh" runat="server" Width="320" Icon="ChartOrganisation"
            AutoScroll="true" Height="310">
            <Listeners>
                <Click Handler="#{btnAccept}.enable();" />
            </Listeners>
            <TopBar>
                <ext:Toolbar ID="Toolbar1" runat="server">
                    <Items>
                        <ext:ToolbarTextItem ID="ToolbarTextItem1" runat="server" Text="Tìm kiếm:" />
                        <ext:ToolbarSpacer />
                        <ext:TriggerField ID="TriggerField1" runat="server" EnableKeyEvents="true">
                            <Triggers>
                                <ext:FieldTrigger Icon="Clear" />
                            </Triggers>
                            <%--<Listeners>
                                <KeyUp Fn="filterTree" Buffer="250" />
                                <TriggerClick Handler="clearFilter();" />
                            </Listeners>--%>
                        </ext:TriggerField>
                    </Items>
                </ext:Toolbar>
            </TopBar>
        </ext:TreePanel>
    </Items>
    <Buttons>
        <ext:Button ID="btnAccept" runat="server" Text="Chọn" Icon="Accept">            
            <Listeners>
                <Click Handler="var currentNode=#{treeToChucHanhChinh}.getSelectionModel().getSelectedNode();InsertToChucHanhChinhTrucThuoc(currentNode.id,currentNode.text);#{wdLookUpToChucHanhChinh}.hide();" />
            </Listeners>
        </ext:Button>
        <ext:Button ID="Button1" runat="server" Text="Đóng" Icon="Cancel">
            <Listeners>
                <Click Handler="#{wdLookUpToChucHanhChinh}.hide();" />
            </Listeners>
        </ext:Button>
    </Buttons>
    <Listeners>
        <BeforeShow Handler="#{btnAccept}.disable();" />
    </Listeners>
</ext:Window>
